<template>
  <div>
    <ma-barcode :row="data" />
  </div>
</template>

<script>
import maBarcode from '@/views/masterdata/barcode/maBarcode'
import _ from 'lodash'
export default {
  components: { maBarcode },
  data() {
    return {
      data: {},
    }
  },
  props: {
    barCodeId: {
      type: String,
      default: '',
    },
  },
  watch: {
    barCodeId: {
      immediate: true,
      // deep: true,
      handler(v) {
        if (!v) {
          this.data = { id: null, is_common: 0 }
          return
        }
        this.$request(this.$api.barcodeRule + 'getbyid', {
          id: this.barCodeId,
        }).then((r) => {
          this.data = _.cloneDeep(r)
        })
      },
    },
  },
}
</script>

<style lang="scss">
</style>